//
//  GFYjDetailTableViewCell.m
//  Qyer
//
//  Created by dlios on 15/10/23.
//  Copyright (c) 2015年 GF. All rights reserved.
//

#import "GFYjDetailTableViewCell.h"

@implementation GFYjDetailTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _image = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:_image];
        
        _desLable =[[UILabel alloc] initWithFrame:CGRectZero];
        [_desLable setFont:[UIFont systemFontOfSize:WIDTH * 15.]];
        [_desLable setNumberOfLines:0];
        [_desLable setTextColor:[NightMode shareNightModeHandle].wordColor];
        [self.contentView addSubview:_desLable];
    }
    return self;
}

- (void)getYjModel:(GFYjModel *)model{
    if (!model.photo) {
        [_image setFrame:CGRectZero];
        if (![model.des isEqualToString:@"null"]) {
            [_desLable setFrame:CGRectMake(5 * WIDTH, 5 * HEIGHT + _image.frame.size.height, SCREEN_WIDTH - 10 * WIDTH, model.height)
             ];
            [_desLable setText:model.des];
        }else{
            [_desLable setFrame:CGRectZero];
        }
    }else{
        [_image setFrame:CGRectMake(5 * WIDTH, 5 * HEIGHT, SCREEN_WIDTH - 10 * WIDTH, 180 * HEIGHT)];
        [_image sd_setImageWithURL:[NSURL URLWithString:[model.photo objectForKey:@"url"]] placeholderImage:[UIImage imageNamed:@"zw.png"]];
        if (model.des != NULL) {
            [_desLable setFrame:CGRectMake(5 * WIDTH, 5 * HEIGHT + _image.frame.size.height, SCREEN_WIDTH - 10 * WIDTH, model.height)
             ];
            [_desLable setText:model.des];
        }else{
            [_desLable setFrame:CGRectZero];
        }
    }
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
